Skip to content

Commit

Permalink
Revert "feat: Ignore 'Some files differ' non-zero exit code"
Browse files Browse the repository at this point in the history
This reverts commit 4bd24ea.
  • Loading branch information
XayahSuSuSu committed Dec 7, 2023
1 parent 9541dd5 commit 342ba94
Showing 1 changed file with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package com.xayah.core.util.command

import com.xayah.core.common.util.toSpaceString
import com.xayah.core.common.util.trim
import com.xayah.core.util.SymbolUtil
import com.xayah.core.util.model.ShellResult
import com.xayah.core.common.util.toSpaceString
import com.xayah.core.common.util.trim

object Tar {
private suspend fun execute(vararg args: String): ShellResult = BaseUtil.execute("tar", *args)

suspend fun compressInCur(usePipe: Boolean, cur: String, src: String, dst: String, extra: String): ShellResult = run {
suspend fun compressInCur(usePipe: Boolean, cur: String, src: String, dst: String, extra: String): ShellResult {
// Move to $cur path.
BaseUtil.execute("cd", cur)

Expand Down Expand Up @@ -59,14 +59,13 @@ object Tar {
// Move back
BaseUtil.execute("cd", "/")

if (result.code == 1) result.code = 0
result
return result
}

suspend fun compress(usePipe: Boolean, exclusionList: List<String>, h: String, srcDir: String, src: String, dst: String, extra: String): ShellResult =
run {
val exclusion = exclusionList.trim().map { "--exclude=$it" }.toSpaceString()
val result = if (usePipe) {
if (usePipe) {
if (extra.isEmpty()) {
// tar --totals "$exclusion" $h -cpf - -C "$srcDir" "$src" > "$dst"
execute(
Expand Down Expand Up @@ -126,9 +125,6 @@ object Tar {
)
}
}

if (result.code == 1) result.code = 0
result
}

suspend fun test(src: String, extra: String): ShellResult = if (extra.isEmpty()) {
Expand Down

0 comments on commit 342ba94

Please sign in to comment.