Skip to content

Commit 2f0f67d

Browse files
authored
Merge pull request microsoft#622 from SimonSiefke/feature/modernize-example-code
feature: modernize example code
2 parents 5f385f6 + 1f284fa commit 2f0f67d

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ The full API for node-pty is contained within the [TypeScript declaration file](
1818
## Example Usage
1919

2020
```js
21-
var os = require('os');
22-
var pty = require('node-pty');
21+
import * as os from 'node:os';
22+
import * as pty from 'node-pty';
2323

24-
var shell = os.platform() === 'win32' ? 'powershell.exe' : 'bash';
24+
const shell = os.platform() === 'win32' ? 'powershell.exe' : 'bash';
2525

26-
var ptyProcess = pty.spawn(shell, [], {
26+
const ptyProcess = pty.spawn(shell, [], {
2727
name: 'xterm-color',
2828
cols: 80,
2929
rows: 30,

examples/fork/index.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
var os = require('os');
2-
var pty = require('../..');
1+
import * as os from 'node:os';
2+
import * as pty from '../../lib/index.js';
33

4-
var isWindows = os.platform() === 'win32';
5-
var shell = isWindows ? 'powershell.exe' : 'bash';
4+
const isWindows = os.platform() === 'win32';
5+
const shell = isWindows ? 'powershell.exe' : 'bash';
66

7-
var ptyProcess = pty.spawn(shell, [], {
7+
const ptyProcess = pty.spawn(shell, [], {
88
name: 'xterm-256color',
99
cols: 80,
1010
rows: 26,

examples/fork/package.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"type": "module"
3+
}

0 commit comments

Comments
 (0)