mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/1Panel-dev/1Panel.git
synced 2026-09-20 08:03:55 +08:00
fix: pass context to rar extraction and simplify sidebar message entry (#12697)
This commit is contained in:
committed by
zhengkunwang223
parent
9508238805
commit
e5b2b5d5dc
@@ -1,23 +0,0 @@
|
||||
package cmd
|
||||
|
||||
import "testing"
|
||||
|
||||
// TestWhich_ExistingBinary verifies that Which() returns true for a
|
||||
// binary that is guaranteed to exist on every Unix-like build host
|
||||
// (`sh`). Regression test for #12605: the previous implementation
|
||||
// shelled out to `which`, which is not always available on minimal
|
||||
// distributions like Arch Linux. The new implementation tries
|
||||
// exec.LookPath first, so this assertion holds regardless of whether
|
||||
// `which` itself is on PATH.
|
||||
func TestWhich_ExistingBinary(t *testing.T) {
|
||||
if !Which("sh") {
|
||||
t.Errorf("Which(\"sh\") = false, want true")
|
||||
}
|
||||
}
|
||||
|
||||
func TestWhich_MissingBinary(t *testing.T) {
|
||||
// A binary name that is extremely unlikely to exist on any host.
|
||||
if Which("definitely-not-a-real-binary-xyzzy-1panel") {
|
||||
t.Errorf("Which(\"definitely-not-a-real-binary-xyzzy-1panel\") = true, want false")
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@ func (z RarArchiver) Extract(ctx context.Context, filePath, dstDir string, _ str
|
||||
if err := checkCmdAvailability("unrar"); err != nil {
|
||||
return err
|
||||
}
|
||||
return cmd.NewCommandMgr().Run("unrar", "x", "-y", "-o+", filePath, dstDir)
|
||||
return cmd.NewCommandMgr(cmd.WithContext(ctx)).Run("unrar", "x", "-y", "-o+", filePath, dstDir)
|
||||
}
|
||||
|
||||
func (z RarArchiver) Compress(ctx context.Context, sourcePaths []string, dstFile string, _ string) (err error) {
|
||||
|
||||
@@ -32,10 +32,8 @@
|
||||
<el-divider class="divider" />
|
||||
|
||||
<div class="dropdown-item" @click="openTask">
|
||||
<div class="node">
|
||||
<SvgIcon class="icon" iconName="p-renwuzhongxin1" />
|
||||
{{ $t('menu.msgCenter') }}
|
||||
</div>
|
||||
<SvgIcon class="icon" iconName="p-renwuzhongxin1" />
|
||||
{{ $t('menu.msgCenter') }}
|
||||
<el-tag class="msg-tag" v-if="taskCount !== 0" size="small" round>{{ taskCount }}</el-tag>
|
||||
</div>
|
||||
<el-divider v-if="showNodes()" class="divider" />
|
||||
|
||||
Reference in New Issue
Block a user