forked from alibaba/arthas
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
save history when job complete. alibaba#9
- Loading branch information
1 parent
afe647d
commit 755c51d
Showing
2 changed files
with
13 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
package com.taobao.arthas.core.shell.system.impl; | ||
|
||
import java.io.File; | ||
import java.util.Date; | ||
import java.util.List; | ||
import java.util.concurrent.atomic.AtomicBoolean; | ||
|
||
import com.taobao.arthas.core.shell.future.Future; | ||
|
@@ -11,6 +13,10 @@ | |
import com.taobao.arthas.core.shell.system.ExecStatus; | ||
import com.taobao.arthas.core.shell.system.Job; | ||
import com.taobao.arthas.core.shell.system.Process; | ||
import com.taobao.arthas.core.shell.term.Term; | ||
import com.taobao.arthas.core.shell.term.impl.TermImpl; | ||
import com.taobao.arthas.core.util.Constants; | ||
import com.taobao.arthas.core.util.FileUtils; | ||
|
||
/** | ||
* @author <a href="mailto:[email protected]">Julien Viet</a> | ||
|
@@ -234,6 +240,12 @@ public void handle(Integer exitCode) { | |
} | ||
terminateFuture.complete(); | ||
|
||
// save command history | ||
Term term = shell.term(); | ||
if (term instanceof TermImpl) { | ||
List<int[]> history = ((TermImpl) term).getReadline().getHistory(); | ||
FileUtils.saveCommandHistory(history, new File(Constants.CMD_HISTORY_FILE)); | ||
} | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters