PSColor icon indicating copy to clipboard operation
PSColor copied to clipboard

Import-Module in profile causes freeze

Open vr8hub opened this issue 7 years ago • 6 comments

PS 5.1 on Win10 1709.

Create a profile.ps1 with a single line in it: Import-Module PSColor

Start ISE (regular or Administrator) with that profile file. It freezes — no response to keyboard, mouse, etc. It has to be killed from Task Manager.

Rename the profile.ps1 to something like pscolor.ps1. Start ISE (without any profile file). Then source the file with . ./pscolor.ps1

It works fine. Something is happening different in the profile file than in sourcing the file.

I've had this replicated by someone else on a different system, so it's not just my system.

vr8hub avatar Nov 07 '17 21:11 vr8hub

One of the forks solved this. I've fixed my local copy, but it would be nice to merge this fix into the released version.

vr8hub avatar Mar 01 '18 00:03 vr8hub

Hey! I added you as a collaborator. I'm a bit swamped at work right now, so I don't have too much time to look after this unfortunately. Feel free to merge it if you want :)

Davlind avatar Mar 01 '18 08:03 Davlind

I’m a bit of a git and GitHub novice (I can find anything, but the actual pushing and pulling and merging of other’s repositories is still a bit hazy), but I should be able to figure it out. Thanks!

On Mar 1, 2018, at 2:05 AM, David Lindblad [email protected] wrote:

Hey! I added you as a collaborator. I'm a bit swamped at work right now, so I don't have too much time to look after this unfortunately. Feel free to merge it if you want :)

vr8hub avatar Mar 01 '18 16:03 vr8hub

I’m hoping you can spare thirty seconds for what is surely a stupid question…

I don’t understand how the “Hidden” code is working. The pattern is “^.”, which means starting with a period. The if check is "if ($hidden.IsMatch($file.Name))”, which, given the pattern, means does the file name start with a period. But the file name doesn’t start with a period (which can easily be seen, because the output includes $file.name, and it’s a normal name, e.g. testhiddenfile.txt), and yet if it has the hidden attribute it shows up with the right color.

What am I missing?

On Mar 1, 2018, at 2:05 AM, David Lindblad [email protected] wrote:

Hey! I added you as a collaborator. I'm a bit swamped at work right now, so I don't have too much time to look after this unfortunately. Feel free to merge it if you want :)

vr8hub avatar Mar 01 '18 23:03 vr8hub

One more, hopefully even quicker. :)

The ProcessInfo.ps1 doesn’t appear to be used — it’s sourced in the PSColor.psm1, but the function is never called. I’m guessing you wanted to add some kind of coloring for processes and just never got it fully plugged in. (I looked at the history for when the file was created, and it’s never called there, either.)

I’ll be glad to finish it, but what were you going to use to determine the color — one of the memory sizes (non-paged, paged, working set), the CPU, or …?

Thanks!

On Mar 1, 2018, at 5:50 PM, Vince Rice [email protected] wrote:

I’m hoping you can spare thirty seconds for what is surely a stupid question…

I don’t understand how the “Hidden” code is working. The pattern is “^.”, which means starting with a period. The if check is "if ($hidden.IsMatch($file.Name))”, which, given the pattern, means does the file name start with a period. But the file name doesn’t start with a period (which can easily be seen, because the output includes $file.name, and it’s a normal name, e.g. testhiddenfile.txt), and yet if it has the hidden attribute it shows up with the right color.

What am I missing?

On Mar 1, 2018, at 2:05 AM, David Lindblad <[email protected] mailto:[email protected]> wrote:

Hey! I added you as a collaborator. I'm a bit swamped at work right now, so I don't have too much time to look after this unfortunately. Feel free to merge it if you want :)

vr8hub avatar Mar 02 '18 00:03 vr8hub

I merged in the outstanding pull request, for the update to Out-Default. However, the originator of the request issued it having only changed the files in release, not in src. In addition, you also had some outstanding changes in src that have never made it to release.

So, I've done the following, in a new "cleanup" branch: Moved the merged changes for the Out-Default changes to src. Standardized formatting in all of the src files. There was a mixture of OTBS and Allman formatting; I'm not religious about formatting, but I do like to see the same formatting across an individual module. I picked OTBS because that seemed to be what you used most recently, and the rest was about half-and-half. Bumped the revision number to 1.1.0.0. Built a new release, so that src/ and release/ are now in sync, and there's a new PSColor.zip.

If all of that is OK with you, I'll merge the branch into master (and if not, you can just delete the branch). If you decide the former, then it would be great if you could then get the new release to PowerShellGallery. I'll be glad to help on that if I can.

I have a couple of ideas for 1.2 (the ProcessInfo changes I asked about in an earlier message) and a global for controlling the file length conversion to kb/mb/gb.

Let me know if you want me to proceed with any of this. This is still your baby, so I have no problem stepping away.

On Mar 1, 2018, at 6:18 PM, Vince Rice [email protected] wrote:

One more, hopefully even quicker. :)

The ProcessInfo.ps1 doesn’t appear to be used — it’s sourced in the PSColor.psm1, but the function is never called. I’m guessing you wanted to add some kind of coloring for processes and just never got it fully plugged in. (I looked at the history for when the file was created, and it’s never called there, either.)

I’ll be glad to finish it, but what were you going to use to determine the color — one of the memory sizes (non-paged, paged, working set), the CPU, or …?

Thanks!

On Mar 1, 2018, at 5:50 PM, Vince Rice <[email protected] mailto:[email protected]> wrote:

I’m hoping you can spare thirty seconds for what is surely a stupid question…

I don’t understand how the “Hidden” code is working. The pattern is “^.”, which means starting with a period. The if check is "if ($hidden.IsMatch($file.Name))”, which, given the pattern, means does the file name start with a period. But the file name doesn’t start with a period (which can easily be seen, because the output includes $file.name, and it’s a normal name, e.g. testhiddenfile.txt), and yet if it has the hidden attribute it shows up with the right color.

What am I missing?

On Mar 1, 2018, at 2:05 AM, David Lindblad <[email protected] mailto:[email protected]> wrote:

Hey! I added you as a collaborator. I'm a bit swamped at work right now, so I don't have too much time to look after this unfortunately. Feel free to merge it if you want :)

vr8hub avatar Mar 04 '18 23:03 vr8hub