@@ -128,7 +128,7 @@ def run(&block)
128
128
129
129
while true
130
130
# If the stop flag was set or we've hit EOF, break out
131
- break if ( self . stop_flag or self . stop_count > 1 )
131
+ break if self . stop_flag || self . stop_count > 1
132
132
133
133
init_tab_complete
134
134
@@ -190,19 +190,21 @@ def run(&block)
190
190
191
191
line = get_input_line
192
192
193
- # If a block was passed in, pass the line to it. If it returns true,
194
- # break out of the shell loop.
195
- if ( block )
196
- break if ( line == nil or block . call ( line ) )
197
- elsif ( input . eof? or line == nil )
198
- # If you have sessions active, this will give you a shot to exit gracefully
199
- # If you really are ambitious, 2 eofs will kick this out
193
+ # If you have sessions active, this will give you a shot to exit
194
+ # gracefully. If you really are ambitious, 2 eofs will kick this out
195
+ if input . eof? || line == nil
200
196
self . stop_count += 1
201
- next if ( self . stop_count > 1 )
197
+ next if self . stop_count > 1
202
198
run_single ( "quit" )
203
- else
199
+
200
+ # If a block was passed in, pass the line to it. If it returns true,
201
+ # break out of the shell loop.
202
+ elsif block
203
+ break if block . call ( line )
204
+
204
205
# Otherwise, call what should be an overriden instance method to
205
206
# process the line.
207
+ else
206
208
ret = run_single ( line )
207
209
# don't bother saving lines that couldn't be found as a
208
210
# command, create the file if it doesn't exist
@@ -370,7 +372,13 @@ def get_input_line
370
372
end
371
373
372
374
output . input = input
373
- line << input . pgets
375
+ str = input . pgets
376
+ if str
377
+ line << str
378
+ else
379
+ line = nil
380
+ end
381
+
374
382
output . input = nil
375
383
log_output ( input . prompt )
376
384
end
0 commit comments