Skip to content

Commit 666a26d

Browse files
committed
fix: wrong script path in production
1 parent a647cb2 commit 666a26d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/ssh/ssh-controller.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -381,10 +381,11 @@ export class MxaCtl {
381381

382382
async execScriptFile(file: string, options: CtlExecOptions = {}) {
383383
const { sudo = !this.isRootUser(), ...restOptions } = options
384-
if (!existsSync(file)) {
385-
throw new Error(`文件 ${file} 不存在`)
384+
const fullPath = join(rootDir, file)
385+
if (!existsSync(fullPath)) {
386+
throw new Error(`文件 ${file} 不存在: ${fullPath}`)
386387
}
387-
const fileContent = await readFile(join(rootDir, file), { encoding: 'utf8' })
388+
const fileContent = await readFile(fullPath, { encoding: 'utf8' })
388389
if (sudo) {
389390
const res = await this.ssh.exec('sudo', ['bash', '-c', fileContent], {
390391
...this.execOptions({ sudo, ...restOptions }),

0 commit comments

Comments
 (0)