import {isEmpty} from './utils' import {callFileCommand, callLogCommand, FILE_COMMAND_ENV} from './cmd' import * as uuid from 'uuid' import os from 'os' export function exportEnvVar(envName: string, envValue: string): void { if (isEmpty(envValue)) { return } process.env[envName] = envValue const commandFilePath = process.env[`FLOW_${FILE_COMMAND_ENV}`] const delimiter = `flow_delimiter_${uuid.v4()}` const command = `${envName}<<${delimiter}${os.EOL}${envValue}${os.EOL}${delimiter}` if (!isEmpty(commandFilePath)) { callFileCommand(FILE_COMMAND_ENV, command) } else { callLogCommand('set-env', {}, command) } }