The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 2,224 other followers

Archive for November 25th, 2020

`exit /b #`: set `errorlevel` to `#`, then exit batch file or subroutine – via: Errorlevel – Windows CMD – SS64.com

Posted by jpluimers on 2020/11/25

I seem to always forget how to set an error leve in side a batch file, but [WayBack] Errorlevel РWindows CMD РSS64.com tells how:

  • When ending a [WayBack]¬†subroutine, you can use¬†EXIT /b¬†N¬†to set a specific ERRORLEVEL¬†N.
  • You can make a [WayBack]¬†batch file¬†return a non-zero exit code by using the [WayBack]¬†EXIT¬†command.

    Exit 0
    Exit /B 5

    To force an ERRORLEVEL of 1 to be set without exiting, run a small but invalid command like [WayBack]COLOR 00 

    There is a key difference between the way .CMD and .BAT batch files set errorlevels:

    An old .BAT batch script running the ‘new’ internal commands: APPEND, ASSOC, PATH, PROMPT, FTYPE and SET will only set¬†ERRORLEVEL¬†if an error occurs. So if you have two commands in the batch script and the first fails, the¬†ERRORLEVEL¬†will remain set even after the second command succeeds.

    This can make debugging a problem BAT script more difficult, a CMD batch script is more consistent and will set ERRORLEVEL after every command that you run [[archive.is]source].

It looks like I already used a bare EXIT /B without explaining it in Source: stop/start IIS.

Further reading, including the difference between subroutines, blocks and batch files:

Finally saving Google Groups messages in the way back machine:

  1. Convert the URL
  2. Save the latter in archive.is

–jeroen

Posted in Batch-Files, Development, Software Development | Leave a Comment »

git – I ran into a merge conflict. How can I abort the merge? – Stack Overflow

Posted by jpluimers on 2020/11/25

Since I keep forgetting how simple it is: [WayBack] git – I ran into a merge conflict. How can I abort the merge? – Stack Overflow

If your git version is >= 1.6.1, you can use git reset --merge.

Also, as @Michael Johnson mentions, if your git version is >= 1.7.4, you can also use git merge --abort.

As always, make sure you have no uncommitted changes before you start a merge.

From the git merge man page:

git merge --abort is equivalent to git reset --merge when MERGE_HEAD is present.

MERGE_HEAD is present when a merge is in progress.

Also, regarding uncommitted changes when starting a merge:

If you have changes you don’t want to commit before starting a merge, just¬†git stash¬†them before the merge and¬†git stash pop¬†after finishing the merge or aborting it.

–jeroen

Posted in Development, DVCS - Distributed Version Control, git, Software Development, Source Code Management | Leave a Comment »

Delphi: why breakpoints from time to time are not usable (green highlighted line on IDE)? – Stack Overflow

Posted by jpluimers on 2020/11/25

I still have not figured out the circumstances, but ever since either the Unicode Delphi versions (2009 and up) or BDS (8 and up), I have this every now and then: [WayBack] Delphi: why breakpoints from time to time are not usable (green highlighted line on IDE)? – Stack Overflow

So far this is consistent, limiting it to:

  • large projects (100+ kilo-lines-of-code)
  • for those projects, either as single .dproj file or as part of a .groupproj
  • debugging works the first time, but fails consistently with these symptoms:
    • break-points fail
    • blue dots in the gutter disappear; red-dots become green
    • exceptions cause a stack-trace with only hex-addresses
  • other projects in the same project group still debug fine

To get it working (one time per try) again:

  • restart the IDE
  • close the project, then re-open it in the same IDE instance

What does not help getting it to work:

  • clean build from the IDE
  • deleting DCU files

–jeroen

Posted in Delphi, Development, Software Development | Leave a Comment »

 
%d bloggers like this: