How to use the safeps.spawnSync function in safeps

To help you get started, we’ve selected a few safeps examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bevry / lazy-require / source / index.js View on Github external
error = new Error(
			'lazy-require: cannot save the module as `opts.cwd` did not contain a `package.json` file'
		)
	}

	// Install
	else {
		// Arguments
		const args = ['npm', 'install', name]
		if (opts.save === true) {
			args.push('--save')
			opts.save = null // {delete opts.save} is very slow
		}

		// Install
		const spawnResult = safeps.spawnSync(args, opts)
		if (spawnResult instanceof Error) {
			error = spawnResult
		} else {
			// Exit
			return lazyRequire.require(name, opts, next)
		}
	}

	// Complete
	return complete(error, null, next)
}

safeps

Work with processes safely and easily with Node.js

Artistic-2.0
Latest version published 12 months ago

Package Health Score

61 / 100
Full package analysis