Skip to content

Commit c6842d5

Browse files
committed
Handle 'asprof -a start' differently
1 parent 077db25 commit c6842d5

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

cf_cli_java_plugin.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ fi`,
259259
},
260260
{
261261
Name: "asprof",
262-
Description: "Run async-profiler commands passed to asprof via --args, copies files in the current folder. Don't use in combination with asprof-* commands. Downloads and deletes all files that are created in the current folder, use '--no-download' to prevent this",
262+
Description: "Run async-profiler commands passed to asprof via --args, copies files in the current folder. Don't use in combination with asprof-* commands. Downloads and deletes all files that are created in the current folder, if not using 'start' asprof command, use '--no-download' to prevent this.",
263263
OnlyOnRecentSapMachine: true,
264264
RequiredTools: []string{"asprof"},
265265
GenerateFiles: false,
@@ -426,6 +426,14 @@ func (c *JavaPlugin) execute(commandExecutor cmd.CommandExecutor, uuidGenerator
426426
}
427427
}
428428
}
429+
if command.Name == "asprof" {
430+
trimmedMiscArgs := strings.TrimLeft(miscArgs, " ")
431+
if len(trimmedMiscArgs) > 6 && trimmedMiscArgs[:6] == "start " {
432+
noDownload = true
433+
} else {
434+
noDownload = trimmedMiscArgs == "start";
435+
}
436+
}
429437
if !command.HasMiscArgs() && commandFlags.IsSet("args") {
430438
return "", &InvalidUsageError{message: fmt.Sprintf("The flag %q is not supported for %s", "args", command.Name)}
431439
}
@@ -550,7 +558,6 @@ func (c *JavaPlugin) execute(commandExecutor cmd.CommandExecutor, uuidGenerator
550558
return "", err
551559
}
552560
if len(files) != 0 {
553-
fmt.Println("Files in the folder: ", files)
554561
for _, file := range files {
555562
localFileFullPath := localDir + "/" + file
556563
err = util.CopyOverCat(cfSSHArguments, fspath+"/"+file, localFileFullPath)

0 commit comments

Comments
 (0)