##// END OF EJS Templates
:bug: Remove `ls` from list of system commands to warn about
Samuel B. Johnson -
Show More
@@ -2414,14 +2414,9 b' class InteractiveShell(SingletonConfigurable):'
2414 cmd = self.var_expand(cmd, depth=1)
2414 cmd = self.var_expand(cmd, depth=1)
2415 # warn if there is an IPython magic alternative.
2415 # warn if there is an IPython magic alternative.
2416 main_cmd = cmd.split()[0]
2416 main_cmd = cmd.split()[0]
2417 has_magic_alternatives = ("pip", "conda", "cd", "ls")
2417 has_magic_alternatives = ("pip", "conda", "cd")
2418
2418
2419 # had to check if the command was an alias expanded because of `ls`
2419 if main_cmd in has_magic_alternatives:
2420 is_alias_expanded = self.alias_manager.is_alias(main_cmd) and (
2421 self.alias_manager.retrieve_alias(main_cmd).strip() == cmd.strip()
2422 )
2423
2424 if main_cmd in has_magic_alternatives and not is_alias_expanded:
2425 warnings.warn(
2420 warnings.warn(
2426 (
2421 (
2427 "You executed the system command !{0} which may not work "
2422 "You executed the system command !{0} which may not work "
@@ -623,7 +623,7 b' class TestSystemRaw(ExitCodeChecks):'
623 self.assertEqual(ip.user_ns["_exit_code"], -signal.SIGINT)
623 self.assertEqual(ip.user_ns["_exit_code"], -signal.SIGINT)
624
624
625 def test_magic_warnings(self):
625 def test_magic_warnings(self):
626 for magic_cmd in ("ls", "pip", "conda", "cd"):
626 for magic_cmd in ("pip", "conda", "cd"):
627 with self.assertWarnsRegex(Warning, "You executed the system command"):
627 with self.assertWarnsRegex(Warning, "You executed the system command"):
628 ip.system_raw(magic_cmd)
628 ip.system_raw(magic_cmd)
629
629
General Comments 0
You need to be logged in to leave comments. Login now