@@ -12,6 +12,7 @@ const child_process = require('child_process');
1212const path = require ( 'path' ) ;
1313const fs = require ( 'fs' ) ;
1414const os = require ( 'os' ) ;
15+ const { spawnSyncAndExitWithoutError } = require ( '../common/child_process' ) ;
1516
1617const nodeBinary = process . execPath ;
1718
@@ -42,30 +43,26 @@ fs.copyFileSync(
4243 nodeBinary ,
4344 appExecutablePath ) ;
4445
45-
4646// Sign the app bundle with sandbox entitlements:
47- assert . strictEqual (
48- child_process . spawnSync ( '/usr/bin/codesign' , [
49- '--entitlements ', fixtures . path (
50- 'macos-app-sandbox' , 'node_sandboxed.entitlements' ) ,
51- '--force' , '-s' , '- ',
52- appBundlePath ,
53- ] ) . status ,
54- 0 ) ;
47+ spawnSyncAndExitWithoutError ( '/usr/bin/codesign' , [
48+ '--entitlements' ,
49+ fixtures . path ( 'macos-app-sandbox ', 'node_sandboxed.entitlements' ) ,
50+ '--force' ,
51+ '-s ',
52+ '-' ,
53+ appBundlePath ,
54+ ] ) ;
5555
5656// Sandboxed app shouldn't be able to read the home dir
57- assert . notStrictEqual (
58- child_process . spawnSync ( appExecutablePath , [
59- '-e' , ' fs.readdirSync(process.argv[1])', os . homedir ( ) ,
60- ] ) . status ,
61- 0 ) ;
57+ spawnSyncAndExitWithoutError ( appExecutablePath , [
58+ '-e' ,
59+ ' fs.readdirSync(process.argv[1])',
60+ os . homedir ( ) ,
61+ ] ) ;
6262
6363if ( process . stdin . isTTY ) {
6464 // Run the sandboxed node instance with inherited tty stdin
65- const spawnResult = child_process . spawnSync (
66- appExecutablePath , [ '-e' , '' ] ,
67- { stdio : 'inherit' }
68- ) ;
69-
70- assert . strictEqual ( spawnResult . signal , null ) ;
65+ spawnSyncAndExitWithoutError ( appExecutablePath , [ '-e' , '' ] , {
66+ stdio : 'inherit' ,
67+ } ) ;
7168}
0 commit comments