Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/choose.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def getLineObjs():
lineObjs = pickle.load(open(filePath, 'rb'))
except:
output.appendError(LOAD_SELECTION_WARNING)
output.appendExit()
sys.exit(1)
logger.addEvent('total_num_files', len(lineObjs))

Expand All @@ -59,7 +60,8 @@ def getLineObjs():
matches = [lineObj for lineObj in lineObjs.values()
if not lineObj.isSimple()]
if not len(matches):
output.writeToFile('echo "No lines matched!!"')
output.writeToFile('echo "No lines matched!!";')
output.appendExit()
sys.exit(0)
return lineObjs

Expand All @@ -69,6 +71,7 @@ def setSelectionsFromPickle(selectionPath, lineObjs):
selectedIndices = pickle.load(open(selectionPath, 'rb'))
except:
output.appendError(LOAD_SELECTION_WARNING)
output.appendExit()
sys.exit(1)
for index in selectedIndices:
if index >= len(lineObjs.items()):
Expand All @@ -87,7 +90,8 @@ def setSelectionsFromPickle(selectionPath, lineObjs):
filePath = stateFiles.getPickleFilePath()
if not os.path.exists(filePath):
print('Nothing to do!')
output.writeToFile('echo ":D"')
output.writeToFile('echo ":D";')
output.appendExit()
sys.exit(0)
output.clearFile()
# we initialize our args *before* we move into curses
Expand Down
5 changes: 5 additions & 0 deletions src/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def execComposedCommand(command, lineObjs):
appendAliasExpansion()
appendIfInvalid(lineObjs)
appendFriendlyCommand(command)
appendExit()


def editFiles(lineObjs):
Expand All @@ -54,6 +55,7 @@ def editFiles(lineObjs):
command = joinEditCommands(partialCommands)
appendIfInvalid(lineObjs)
appendToFile(command)
appendExit()


# Private helpers
Expand Down Expand Up @@ -193,6 +195,9 @@ def appendToFile(command):
file.close()
logger.output()

def appendExit():
appendToFile('exit $?;')


def writeToFile(command):
file = open(stateFiles.getScriptOutputFilePath(), 'w')
Expand Down