本文整理汇总了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);
});