Skip to content

Commit

Permalink
Merge branch 'main' of github.com:koush/scrypted
Browse files Browse the repository at this point in the history
  • Loading branch information
koush committed May 2, 2024
2 parents 106fc1b + 4b055f5 commit d69ec69
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
7 changes: 5 additions & 2 deletions install/local/install-scrypted-dependencies-win.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ $SCRYPTED_HOME_ESCAPED_PATH = $SCRYPTED_HOME.replace('\', '\\')
npm install --prefix $SCRYPTED_HOME @koush/node-windows --save

$NPX_PATH = (Get-Command npx).Path
$NPX_PATH_ESCAPED = $NPX_PATH.replace('\', '\\')
# The path needs double quotes to handle spaces in the directory path
$NPX_PATH_ESCAPED = '"' + $NPX_PATH.replace('\', '\\') + '"'

$SERVICE_JS = @"
const fs = require('fs');
Expand All @@ -44,8 +45,10 @@ try {
catch (e) {
}
const child_process = require('child_process');
child_process.spawn('$($NPX_PATH_ESCAPED)', ['-y', 'scrypted', 'serve'], {
child_process.spawn('$NPX_PATH_ESCAPED', ['-y', 'scrypted', 'serve'], {
stdio: 'inherit',
// allow spawning .cmd https://nodejs.org/en/blog/vulnerability/april-2024-security-releases-2
shell: true,
});
"@

Expand Down
2 changes: 2 additions & 0 deletions packages/cli/src/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ async function runCommand(command: string, ...args: string[]) {
// https://github.com/lovell/sharp/blob/eefaa998725cf345227d94b40615e090495c6d09/lib/libvips.js#L115C19-L115C46
SHARP_IGNORE_GLOBAL_LIBVIPS: 'true',
},
// allow spawning .cmd https://nodejs.org/en/blog/vulnerability/april-2024-security-releases-2
shell: os.platform() === 'win32' ? true : undefined,
});
await once(cp, 'exit');
if (cp.exitCode)
Expand Down
2 changes: 2 additions & 0 deletions server/src/plugin/plugin-npm-dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ export async function installOptionalDependencies(console: Console, packageJson:
const cp = npmExecFunction(['--prefix', nodePrefix, 'install'], {
cwd: nodePrefix,
stdio: 'inherit',
// allow spawning .cmd https://nodejs.org/en/blog/vulnerability/april-2024-security-releases-2
shell: os.platform() === 'win32' ? true : undefined,
});

await once(cp, 'exit');
Expand Down

0 comments on commit d69ec69

Please sign in to comment.