]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - shared/server-commands/server/servers-command.ts
Translated using Weblate (Japanese)
[github/Chocobozzz/PeerTube.git] / shared / server-commands / server / servers-command.ts
index 47420c95f209891574bebc798d97e2965ef1c104..19645cb93a1eae15e82389a9ff4a014d4b351024 100644 (file)
@@ -1,9 +1,9 @@
 import { exec } from 'child_process'
 import { copy, ensureDir, readFile, remove } from 'fs-extra'
 import { basename, join } from 'path'
-import { root } from '@shared/core-utils'
+import { isGithubCI, root, wait } from '@shared/core-utils'
+import { getFileSize } from '@shared/extra-utils'
 import { HttpStatusCode } from '@shared/models'
-import { getFileSize, isGithubCI, wait } from '../miscs'
 import { AbstractCommand, OverrideCommandOptions } from '../shared'
 
 export class ServersCommand extends AbstractCommand {
@@ -30,10 +30,12 @@ export class ServersCommand extends AbstractCommand {
     })
   }
 
-  async cleanupTests () {
-    const p: Promise<any>[] = []
+  cleanupTests () {
+    const promises: Promise<any>[] = []
+
+    const saveGithubLogsIfNeeded = async () => {
+      if (!isGithubCI()) return
 
-    if (isGithubCI()) {
       await ensureDir('artifacts')
 
       const origin = this.buildDirectory('logs/peertube.log')
@@ -44,14 +46,17 @@ export class ServersCommand extends AbstractCommand {
     }
 
     if (this.server.parallel) {
-      p.push(ServersCommand.flushTests(this.server.internalServerNumber))
+      const promise = saveGithubLogsIfNeeded()
+                        .then(() => ServersCommand.flushTests(this.server.internalServerNumber))
+
+      promises.push(promise)
     }
 
     if (this.server.customConfigFile) {
-      p.push(remove(this.server.customConfigFile))
+      promises.push(remove(this.server.customConfigFile))
     }
 
-    return p
+    return promises
   }
 
   async waitUntilLog (str: string, count = 1, strictCount = true) {