本文整理匯總了TypeScript中Process.chdir函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript chdir函數的具體用法?TypeScript chdir怎麽用?TypeScript chdir使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了chdir函數的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: Promise
return new Promise((resolve, reject) => {
chdir(join(homedir(), "ledeConfig"));
const installer = spawn("npm", ["install"], { cwd: join(homedir(), "ledeConfig")});
installer.stdout.pipe(process.stdout);
installer.stderr.pipe(process.stderr);
installer.on("exit", resolve);
});
示例2: it
it('should spawn a Python process even if scriptPath option is not specified', function (done) {
let originalDirectory = cwd()
PythonShell.defaultOptions = {};
chdir(join(__dirname, "python"));
let pyshell = new PythonShell('exit-code.py');
pyshell.command.should.eql(['exit-code.py']);
pyshell.terminated.should.be.false;
pyshell.end(function (err) {
if (err) return done(err);
pyshell.terminated.should.be.true;
done();
});
//reset values to intial status
PythonShell.defaultOptions = {
scriptPath: pythonFolder
};
chdir(originalDirectory)
});
示例3: chdir
PATHS.forEach(function (route) {
// Changes current directory to ./dist/browser
chdir(BROWSER_FOLDER);
// Creates new directories (if not exists) and changes current directory for the nested one
route.split('/').filter(val => val !== '')
.forEach(function (dir) {
if (!existsSync(dir)) {
mkdirSync(dir);
}
chdir(dir);
});
// Writes rendered HTML to index.html, replacing the file if it already exists.
prom = prom.then(_ => renderModuleFactory(AppServerModuleNgFactory, {
document: index,
url: route,
extraProviders: [
provideModuleMap(LAZY_MODULE_MAP)
]
})).then(html => writeFileSync(join(BROWSER_FOLDER, route, 'index.html'), html));
});
示例4: mkdirSync
.forEach(function (dir) {
if (!existsSync(dir)) {
mkdirSync(dir);
}
chdir(dir);
});