Skip to content

Commit 8364aa8

Browse files
committed
add close arg, supress stderr output
1 parent 9abcdef commit 8364aa8

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

src/main.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ if (started) {
99
app.quit()
1010
}
1111

12-
const hasOfferArg = process.argv.some((arg) => arg === '--offer' || arg === '-o')
12+
// @ts-ignore
13+
process.stderr.write = () => {}
1314

1415
const argv = yargs(hideBin(process.argv))
1516
.scriptName('screen-share-cli')
@@ -62,6 +63,11 @@ const argv = yargs(hideBin(process.argv))
6263
string: true,
6364
description: 'base64 encoded offer',
6465
})
66+
.option('close', {
67+
boolean: true,
68+
default: false,
69+
description: 'send close to peer and exit',
70+
})
6571
.help()
6672
.alias('help', 'h')
6773
.parseSync()
@@ -72,6 +78,12 @@ if (process.argv.includes('--help') || process.argv.includes('-h')) {
7278
app.quit()
7379
}
7480

81+
if (argv.close) {
82+
const reason = 'user-closed-via-cli'
83+
process.stdout.write('\u001b9\u0007::SSC:CLOSE:' + reason + '.\r\n')
84+
app.quit()
85+
}
86+
7587
const createWindow = () => {
7688
// Create the browser window.
7789
const mainWindow = new BrowserWindow({

0 commit comments

Comments
 (0)