import process from 'process' import {callFileCommand, callLogCommand, FILE_COMMAND_PATH} from './cmd' import {isEmpty} from './utils' import path from 'path' export function addPath(newPath: string): void { if (isEmpty(newPath)) { return } const commandFilePath = process.env[`FLOW_${FILE_COMMAND_PATH}`] if (!isEmpty(commandFilePath)) { callFileCommand(FILE_COMMAND_PATH, newPath) } else { callLogCommand('add-path', {}, newPath) } // 当前的进程添加PATH process.env['PATH'] = `${newPath}${path.delimiter}${process.env['PATH']}` }